<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<title></title>
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
<!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
	<section class="content-header">
		<h1>遴选结果查询</h1>
		<ol class="breadcrumb">
			<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
			<li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#">配送关系</a></li>
			<li class="active"><a href="#">遴选结果查询</a></li>
		</ol>
	</section>
	<section class="content">
		<div class=" box box-success">
			<div class="box-body">
				<div class="input">
                    <div class="textalign1">地区名称：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="areaName" placeholder="地区名称" maxlength="32"/>
                    </div>
                    <div class="textalign1">
					   <button id="selectArea" type="button" class="btn btn-success btn-sm" onclick="search();">查 询</button>
				    </div>
				</div>
			</div>
		</div>
		<table class="jqgrid" id="gridlist"></table>
		<div id="gridpage"></div>
	</section>
	<%@ include file="/WEB-INF/component/commonJS.jsp"%>
	<script type="text/javascript">
        $(function () {        	
        	 $('.input :input').bind('keydown', function(event) {if (event.keyCode == "13") {search();}}).eq(0).focus();
            $("#gridlist").jqGrid({
                url: "${pageContext.request.contextPath}/baseDelByPs/getDelRangeResultByPs.html",
                mtype: "POST",
                contentType : 'application/json',
                datatype: "json",
                autowidth: true,
              //  height: 380,
                colNames: [
                           '地区编码',
                           '地区名称',
                           '地区完整名称',
                           '配送范围',
                           '状态'
                           ],
                colModel: [
                    { name: 'areaCode',key:true, width: 40, align: 'center' ,sortable: false},
                    { name: 'areaName', width: 60 , align: 'center',sortable: false},
                    { name: 'arFullname', width: 80, align: 'center',sortable: false },
                    { name: 'delRange', width: 80, align: 'center',sortable: false},
                    { name: 'status', width: 80, align: 'center',sortable: false,
                    	formatter:function(cellvalue, options, row){
                    		//状态 0其他 1未遴选 2遴选通过 3遴选不通过
                    		return cellvalue==0?"其他":(cellvalue==1?"未遴选":(cellvalue==2?"遴选通过":(cellvalue==3?"遴选不通过":"--")));
                   		} 
                    }
                ],
                rowNum: 0,
                rownumbers: true,
                viewrecords: true,
                multiselect: false,
					gridComplete:function(){
				//序号列宽度自适应（参数为jqgridID）
				//autoRNWidth("gridlist");
				//数据只有一条时默认选中（参数为jqgridID）
				selectByOneData("gridlist");
				},

                caption: "地区列表",
                jsonReader: {
                    repeatitems: false,
                    id: "areaCode"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
			$("#gridlist").jqGrid("setGridHeight", create());
        });
        
        //查询
        function search() {
        	var areaCode = $.trim($("#areaCode").val());
            var areaName = $.trim($("#areaName").val());
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"areaCode":areaCode,
                        "areaName":areaName
                        },
                        page : 1
            }).trigger("reloadGrid"); //重新载入  
        }
        
    </script>
</body>
</html>